<include file="Public/header" title="待审核订单详情" bdstyle="background:#f2f2f2;"/>
<include file="Public/header_back"/> 
    <article class="order-review">
        <div class="order-head flex-justify">
            <span>订单号：{$order_data.order_sn}</span>
            <span>待审核</span>
        </div>
        <div class="entrepreneurial-package1 flex-align">
            <div></div>
            <div class="flex-1">
                <h4>{$order_data.goods_name}</h4>
                <p><span>下单时间<span> {:date('Y-m-d H:i:s',$order_data['add_time'])}</p>
                <p class="clearfix"><span>合同金额<span> ￥{$order_data.order_amount} <a href="">查看合同</a></p>
            </div>
        </div>
       	<form name="dataForm">
	        <div class="coupon-code flex-justify">
	        	<input type="hidden" name="order_id" value="{$order_data.order_id}"/>
	            <div>
	                <span>优惠券码</span>
	                <input type="text" name="jcode" placeholder="请输入优惠码"/>
	            </div>
	            <a href="javascript:void(0);" onclick="save_jcode(this,'$order_data['order_id']')">提交</a>
	        </div>
        </form>
        <div class="cancel"><a href="javascript:void(0)" onclick="cancel_order('{$order_data['order_id']}')">取消订单</a></div>
    </article>
    <article class="payment-amount">
        <h3>支付金额</h3>
        <div class="apply-list">
            <foreach name="order_goods" item="val">
            <div class="flex-justify">
                <span>{$val.goods_name}</span>
                <span>￥{$val.goods_price}</span>
            </div>
            </foreach>
        </div>
        <div class="total-price">
            <strong>合计</strong><span><i>￥</i>{$order_data.order_amount}</span>
        </div>
    </article>
    <article class="payment-method">
        <h3>支持支付方式</h3>
        <div>
            <div class="flex-align"><img src="__PUBLIC__/home/images/payment-method1.png"/>银行汇款/转账</div>
            <div class="flex-align"><img src="__PUBLIC__/home/images/payment-method2.png"/>微信支付</div>
            <div class="flex-align"><img src="__PUBLIC__/home/images/payment-method3.png"/>在线支付</div>
        </div>
    </article>
    <article class="data-wrap personal-data">
    	<form name="dataForm">
    	<input type="hidden" name="order_id" value="{$order_data.order_id}"/>
        <h3 class="flex-justify down-up"><span>发票信息</span><img src="__PUBLIC__/home/images/up.png" /></h3>
        <div class="data-input">
            <section class="flex-justify">
                <span>发票种类</span>
                <select name="inv_online">
                	<option value="0" {:$order_data['inv_online'] != '1'?'checked':''}>纸质发票</option>
                	<option value="1" {:$order_data['inv_online'] == '1'?'checked':''}>电子发票</option>
                </select>
            </section>
            <section class="flex-justify">
                <span>发票类型</span>
                <select name="inv_type">
                	<option value="增值税普通发票" {:$order_data['inv_type'] == '增值税普通发票'?'checked':''}>增值税普通发票</option>
                	<option value="增值税专用发票" {:$order_data['inv_type'] == '增值税专用发票'?'checked':''}>增值税专用发票</option>
                </select>
            </section>
            <section class="flex-justify">
                <span>发票内容</span>
                <select name="inv_content">
                	<option value="咨询费">咨询费</option>
                	<option value="明细">明细</option>
                </select>
            </section>
            <section class="flex-justify">
                <span>以往开发票</span>
                <select name="inv_old">
                	<if condition="$inv_data">
	                	<foreach name="inv_data" item="val">
	                		<option value="{$val.order_id}">{$val.inv_payee}</option>
	                	</foreach>
                	<else/>
                		<option value="">无</option>
                	</if>
                </select>
            </section>
            <section class="flex-justify">
                <span>单位名称</span>
                <input type="text" name="inv_payee" class="flex-1" placeholder="请输入单位名称" value="{$order_data.inv_payee}"/>
            </section>
            <section class="flex-justify">
                <span>纳税人识别号</span>
                <input type="text" name="inv_num" class="flex-1" placeholder="请输入纳税人识别号" value="{$order_data.inv_num}"/>
            </section>
            <section class="flex-justify">
                <span>开户银行</span>
                <input type="text" name="inv_bank" class="flex-1" placeholder="请输入开户银行" value="{$order_data.inv_bank}"/>
            </section>
            <section class="flex-justify">
                <span>银行账户</span>
                <input type="text" name="inv_account" class="flex-1" placeholder="请输入银行账户" value="{$order_data.inv_account}"/>
            </section>
            <section class="flex-justify">
                <span>注册电话</span>
                <input type="text" name="inv_phone" class="flex-1" placeholder="请输入注册电话" value="{$order_data.inv_phone}"/>
            </section>
            <section class="invoice-list no-border refund-ticket">
                <h4>注册地址</h4>
                <textarea name="inv_addr" placeholder="请输入注册地址">{$order_data.inv_addr}</textarea>
            </section>
            <a href="javascript:void(0)" onclick="save_inv(this,'{$order_data.order_id}')" class="invoice-preservation">保存</a>
        </div>
        </form>
    </article>
    <article class="data-wrap personal-data">
    	<form name="dataForm">
    	<input type="hidden" name="order_id" value="{$order_data.order_id}"/>
        <h3>请填写收件地址</h3>
        <div class="data-input">
            <section class="flex-justify">
                <span>联系人姓名</span>
                <input type="text" name="consignee" class="flex-1" placeholder="请输入联系人姓名" value="{$order_data.consignee}"/>
            </section>
            <section class="flex-justify">
                <span>联系人电话</span>
                <input type="text" name="mobile" class="flex-1" placeholder="请输入联系人电话" value="{$order_data.mobile}"/>
            </section>
            <section class="flex-justify">
                <span>邮政编码</span>
                <input type="text" name="zipcode" class="flex-1" placeholder="请输入邮政编码" value="{$order_data.zipcode}"/>
            </section>
            <section class="flex-justify">
                <span>电子邮件</span>
                <input type="text" name="email" class="flex-1" placeholder="请输入电子邮件" value="{$order_data.email}"/>
            </section>
            <section class="flex-justify">
                <span>省市区</span>
                <span class="flex-1 address-section clearfix">
	                <select name="province" onchange="getCitys(this)">
	                	<option value="">省份</option>
		                <foreach name="provinces" item="val">
		                <option value="{$val.region_id}" {:$order_data['province'] == $val['region_id']?'selected':''}>{$val.region_name}</option>
		                </foreach>
	                </select>
	                <select name="city" onchange="getDistricts(this)">
	                	<option value="">城市</option>
	                	<if condition="citys">
	                	<foreach name="citys" item="val">
	                	<option value="{$val.region_id}" {:$order_data['city'] == $val['region_id']?'selected':''}>{$val.region_name}</option>
		            	</foreach>
		            	</if>
		            </select>
		            <select name="district">
		                <option value="">地区</option>
		                <if condition="districts">
		            	<foreach name="districts" item="val">
		                <option value="{$val.region_id}" {:$order_data['district'] == $val['region_id']?'selected':''}>{$val.region_name}</option>
	                	</foreach>
	                	</if>
	                </select>
                </span>
            </section>
            <section class="invoice-list no-border refund-ticket">
                <h4>详细地址</h4>
                <textarea name="address" placeholder="请输入详细地址">{$order_data.address}</textarea>
            </section>
            <a href="javascript:void(0)" onclick="save_address(this)" class="invoice-preservation">保存</a>
        </div>
        </form>
    </article>
    <article class="process">
        <img src="__PUBLIC__/home/images/process.jpg" />
    </article>
    
    <article class="process-title">
        <h3 class="flex-align"><span class="flex-1">中国（上海）自由自贸区试验区内资公司设立</span><img src="__PUBLIC__/home/images/down.png" /></h3>
    </article>
    <article class="process-title">
        <h3 class="flex-align"><span class="flex-1">中国（上海）自由自贸区试验区内资公司设立</span><img src="__PUBLIC__/home/images/down.png" /></h3>
    </article>
    <article class="process-title">
        <h3 class="flex-align"><span class="flex-1">中国（上海）自由自贸区试验区内资公司设立</span><img src="__PUBLIC__/home/images/down.png" /></h3>
    </article>
    <article class="process-title">
        <h3 class="flex-align"><span class="flex-1">中国（上海）自由自贸区试验区内资公司设立</span><img src="__PUBLIC__/home/images/down.png" /></h3>
    </article>
<script>
function save_jcode(obj){
	location.reload();
	return false;
}
function save_inv(obj){
	$.post(
		"{:U('saveInv')}",
		$(obj).parents('form[name=dataForm]').serializeArray(),
		function(data){
			if(data.status == '1'){
				layer.msg(data.info);
				setTimeout("location.reload()",1000);
			}else{
				layer.msg(data.info)
			}
		}
	);
}
function save_address(obj){
	$.post(
		"{:U('saveConsignee')}",
		$(obj).parents('form[name=dataForm]').serializeArray(),
		function(data){
			if(data.status == '1'){
				layer.msg(data.info);
				setTimeout("location.reload()",1000);
			}else{
				layer.msg(data.info)
			}
		}
	);
}
function cancel_order(order_id){
	if(order_id == '')return false;
	if(confirm('确定要取消该订单吗？')){
		$.post(
			"{:U('Ucenter/deleteOrder')}",
			{order_id:order_id},
			function(data){
				if(data.status == '1'){
					layer.msg(data.info);
					setTimeout("location.href='"+document.referrer+"'",1000);
				}else{
					layer.msg(data.info);
				}
			}
		)
	}
}
function getCitys(obj){
	var province = $(obj).val(); 
	if(province == ''){
		$('select[name=city]').html('<option value="">城市</option>');
		$('select[name=district]').html('<option value="">地区</option>');
		return false;
	}
	$.post(
		"{:U('Ucenter/getCitys')}",
		{province:province},
		function(data){
			if(data.status == '1'){
				var citys = data.info.citys;
				var districts = data.info.districts;
				var citystr='';
				var districtstr = '';
				for(var i=0;i<citys.length;i++){
					citystr += '<option value="'+citys[i].region_id+'">'+citys[i].region_name+'</option>';
				}
				for(var i=0;i<districts.length;i++){
					districtstr += '<option value="'+districts[i].region_id+'">'+districts[i].region_name+'</option>';
				}
				if(citystr != ''){
					$('select[name=city]').html(citystr)
				}else{
					$('select[name=city]').html('<option value="">城市</option>');
				}
				if(districtstr != ''){
					$('select[name=district]').html(districtstr)
				}else{
					$('select[name=district]').html('<option value="">地区</option>');
				}
			}else{
				layer.msg(data.info);
			}
		}
	)
}
function getDistricts(obj){
	var city = $(obj).val();
	if(city == ''){
		$('select[name=district]').html('<option value="">地区</option>');
		return false;
	}
	$.post(
		"{:U('Ucenter/getDistricts')}",
		{city:city},
		function(data){
			if(data.status == '1'){
				var districtstr = '';
				var districts = data.info;
				for(var i=0;i<districts.length;i++){
					districtstr += '<option value="'+districts[i].region_id+'">'+districts[i].region_name+'</option>';
				}
				if(districtstr != ''){
					$('select[name=district]').html(districtstr)
				}else{
					$('select[name=district]').html('<option value="">地区</option>');
				}
			}else{
				layer.msg(data.info);
			}
		}
	)
}
</script>
<include file="Public/footer"/>


